﻿
@{
    ViewBag.Title = "Login";
    Layout = "~/Views/Shared/CommonView.cshtml";
}
<div>
    <a style="position:fixed;top:0px;margin:5px;text-align:center" href="~/Yichen/Index">
        <img src="~/Upload/back.png" style="width:40px;height:40px;" />
    </a>
        <div class="form-group">
            <label for="LoginName">LoginName</label>
            <input type="text" class="form-control" id="LoginName" name="LoginName" placeholder="LoginName">
        </div>
        <div class="form-group">
            <label for="Password">Password</label>
            <input type="password" class="form-control" id="Password" name="Password" placeholder="Password">
        </div>

        <button type="button" class="btn btn-default" onclick="Check()">Submit</button>
</div>
<div style="text-align:center;">
    <a href="/User/Regest">注册新用户</a>
</div>
 @section js{
     <script>
         function Check() {
             var LoginName = $("#LoginName").val();
             var Password = $("#Password").val();
             $.ajax({
                 url: "/user/LoginCheck",//链接视图
                 data: { LoginName: LoginName, PWD: Password },//传递数据
                 async: true,
                 type: "POST",
                 success: function (result) {
                     if (result.code == 1) {
                         location.href = "/yichen/index";
                     } else {
                         alert("账号或密码出错");
                     }
                 }
             });
         }
     </script>
}